Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

standardized-audio-context

Package Overview
Dependencies
Maintainers
1
Versions
482
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standardized-audio-context

A cross-browser implementation of the AudioContext which aims to closely follow the standard.

  • 12.1.28
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
137K
increased by23.51%
Maintainers
1
Weekly downloads
 
Created

What is standardized-audio-context?

The standardized-audio-context npm package provides a standardized way to work with the Web Audio API across different browsers. It aims to offer a consistent and reliable interface for audio processing and synthesis, making it easier to create complex audio applications.

What are standardized-audio-context's main functionalities?

Creating an Audio Context

This code initializes a new AudioContext, which is the primary interface for managing and playing audio in a web application.

const audioContext = new AudioContext();

Loading and Playing Audio

This code demonstrates how to load an audio file, decode it, and play it using the AudioContext.

const audioContext = new AudioContext();
fetch('path/to/audio/file.mp3')
  .then(response => response.arrayBuffer())
  .then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer))
  .then(audioBuffer => {
    const source = audioContext.createBufferSource();
    source.buffer = audioBuffer;
    source.connect(audioContext.destination);
    source.start();
  });

Creating and Connecting Audio Nodes

This code shows how to create an oscillator node and a gain node, connect them, and start the oscillator to produce sound.

const audioContext = new AudioContext();
const oscillator = audioContext.createOscillator();
const gainNode = audioContext.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioContext.destination);
oscillator.start();

Applying Audio Effects

This code demonstrates how to apply a biquad filter effect to an audio signal by connecting an oscillator node to a gain node, then to a biquad filter node, and finally to the audio context's destination.

const audioContext = new AudioContext();
const oscillator = audioContext.createOscillator();
const gainNode = audioContext.createGain();
const biquadFilter = audioContext.createBiquadFilter();
oscillator.connect(gainNode);
gainNode.connect(biquadFilter);
biquadFilter.connect(audioContext.destination);
oscillator.start();

Other packages similar to standardized-audio-context

Keywords

FAQs

Package last updated on 10 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc